package com.wwh.proxy2;

import org.junit.jupiter.api.Test;

/**
 * @author Albert
 * @date 2024/8/26-21:45
 * @describe
 */
public class TestCalculator {
    @Test
    public void testCalculatorByTraditional(){
        SmartAnimal sa = new Calculator();
        int num1 = 10;
        int num2 = 2;
        System.out.println("日志-方法名-getSum-参数" + num1 + " " + num2);
        int sum = sa.getSum(num1, num2);
        System.out.println("日志-方法名-getSum-结果resul=" + sum);

        System.out.println("===========================================================");
        System.out.println("日志-方法名-getSub-参数" + num1 + " " + num2);
        int sub = sa.getSub(num1, num2);
        System.out.println("日志-方法名-getSub-结果resul=" + sub);
    }

    @Test
    public void testCalculatorByProxy(){
        SmartAnimal sa = new Calculator();
        CalculatorProxy calculatorProxy = new CalculatorProxy(sa);
        sa = calculatorProxy.getProxy();

        sa.getSum(10, 2);
        System.out.println("============================");
        sa.getSub(10, 2);
    }
}
